const list = [
  {
    id: 1,
    type: '数据源类型',
    name: '数据源1',
    url: 'http://122.1.121:1111',
    deptName: 'ddddd',
  },
  {
    id: 2,
    type: '数据源类型',
    name: '数据源2',
    url: 'http://122.1.122:2222',
    deptName: 'ddddd',
  }
]

const nodeList = mockNodeList()
function mockNodeList() {
  var arr = []
  var length = 100
  for (let i = 1; i < length; i++) {
      arr.push({id: i,
        nodeIp: '192.168.0.'+i,
        port: 8000+i,
        memo: '备注信息'+i,})
  }
  return arr
}


export default [
  // getModules
  {
    url: '/src/list',
    method: 'get',
    response: ({ body }) => {
      return {
        status: 200,
        data: {
          list: list,
          total: list.length
        }
      }
    }
  },
  {
    url: '/src/add',
    method: 'post',
    response: ({ body }) => {
      return {
        status: 201,
        data: {}
      }
    }
  },
  {
    url: '/src/detail/1',
    method: 'post',
    response: ({ body }) => {
      return {
        status: 200,
        data: list[0]
      }
    }
  },

  // 节点信息
  {
    url: '/node/list',
    method: 'get',
    response: ({ body }) => {
      return {
        status: 200,
        data: {
          list: nodeList,
          total: nodeList.length
        }
      }
    }
  },
  {
    url: '/node/add',
    method: 'post',
    response: ({ body }) => {
      return {
        status: 201,
        data: {}
      }
    }
  },
  {
    url: '/node/detail/1',
    method: 'get',
    response: ({ body }) => {
      return {
        status: 200,
        data: nodeList[0]
      }
    }
  },
  {
    url: '/node/modify/1',
    method: 'put',
    response: ({ body }) => {
      return {
        status: 201,
        data: {}
      }
    }
  }, 
  {
    url: '/node/delete/1',
    method: 'delete',
    response: ({ body }) => {
      return {
        status: 201,
        data: {}
      }
    }
  },
]
